#pragma once

#include <LitMovable.h>
#include <OgreManualObject.h>

namespace Lit
{
	class Plane : public Movable
	{
		OgreManualObjPtr	mObject;
		PlaneAxis			mAxis;
		Vec2				mSize;
		OgreEntityPtr		mEntity;
		std::string			mMeshName;
		OgreMeshPtr			mMesh;

	protected:

		OgreMaterialPtr		_createMaterial( );
		OgreManualObjPtr	_createXZ( ); // floor
		OgreManualObjPtr	_createXY( ); // lwall
		OgreManualObjPtr	_createYZ( ); // fwall
		void _add( const Vec3& pos, const Vec2 &uv = Vec2(0,0), const Vec3& normal = Ogre::Vector3::ZERO );

	public:
		Plane(PlaneAxis ax, const std::string &name, const Vec2 &size);
		~Plane(void);

		const std::string& getMeshName() const;
		OgreMeshPtr getMesh() const;

		void create(OgreSceneManagerPtr mgr);
		void destroy();

		void exportAttribs( TiXmlElement * elem );
		void importAttribs( TiXmlElement * elem );
	};

	typedef RefPtr<Plane> PlanePtr;
};